<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-bind 指令</title>
    <!-- 开发环境版本，包含了有帮助的命令行警告 -->
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <style>
        .div {
            border: 5px solid pink;
        }
    </style>
</head>

<body>
    <div id="app">
        <!-- v-bind 为元素绑定属性 -->
        <!-- v-bind:src 可以写成:src  -->
        <img v-bind:src="img" alt="">
        <img :src="img" alt="" :title="imgText" :class="isClass?'div':''" @click="add">
        <img :src="img" alt="" :title="imgText" :class="{div:isClass}" @click="add">
    </div>
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                img: '../DOM和BOM/images/s.gif',
                imgText: '早上好！！！！',
                isClass: false,
            },
            methods: {
                add: function () {
                    this.isClass = !this.isClass;
                },
            }
        });
    </script>
</body>

</html>